home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 19 / madtrb14.zip / CDNORM.PAS < prev    next >
Pascal/Delphi Source File  |  1985-05-17  |  2KB  |  39 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*              CDNorm  -- Cumulative normal distribution probability      *)
  3. (*-------------------------------------------------------------------------*)
  4.  
  5. FUNCTION CDNorm( X : REAL ) : REAL;
  6.  
  7. (*-------------------------------------------------------------------------*)
  8. (*                                                                         *)
  9. (*       Function:  CDNorm                                                 *)
  10. (*                                                                         *)
  11. (*       Purpose:   Evaluates cumulative normal distribution probability   *)
  12. (*                                                                         *)
  13. (*       Calling Sequence:                                                 *)
  14. (*                                                                         *)
  15. (*            P     := CDNorm( X );                                        *)
  16. (*                                                                         *)
  17. (*                 X      --- ordinate of normal distribution              *)
  18. (*                                                                         *)
  19. (*                 P      --- Resultant cumulative probability             *)
  20. (*                                                                         *)
  21. (*       Calls:                                                            *)
  22. (*                                                                         *)
  23. (*            Erf                                                          *)
  24. (*                                                                         *)
  25. (*       Method:                                                           *)
  26. (*                                                                         *)
  27. (*            The simple relationship between the error function and the   *)
  28. (*            normal distribution is used.                                 *)
  29. (*                                                                         *)
  30. (*-------------------------------------------------------------------------*)
  31.  
  32. BEGIN (* CDNorm *)
  33.  
  34.    IF X >= 0.0 THEN
  35.       CDNorm := ( 1.0 + Erf(  X / Sqrt2 ) ) / 2.0
  36.    ELSE
  37.       CDNorm := ( 1.0 - Erf( -X / Sqrt2 ) ) / 2.0;
  38.  
  39. END   (* CDNorm *);